package com.fs.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fs.mapper.WhOutboundMapper;
import com.fs.pojo.WhOutbound;
import com.fs.pojo.WhWarehousing;
import com.fs.service.WhOutboundService;
import com.fs.vo.Condition;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author python_boy
 * @fileName WhOutboundServiceImpl
 * @date 2024/10/11 19:34
 * @description 出库单业务逻辑实现类
 **/
@Service
public class WhOutboundServiceImpl implements WhOutboundService {

    @Autowired
    private WhOutboundMapper whOutboundMapper;

    /**
     * 获取出库单列表
     * @return 出库单列表
     */
    @Override
    public List<WhOutbound> getWhOutboundList() {
        return whOutboundMapper.selectList(null);
    }

    @Override
    public PageInfo<WhOutbound> selectPage(Condition<WhOutbound> condition) {
        PageHelper.startPage(condition.getPage(), condition.getCount());
        List<WhOutbound> whWarehousings = whOutboundMapper.selectAll(condition.getSearch());
        return new PageInfo<>(whWarehousings);
    }

    /**
     * 根据出库单编号获取出库单
     * @param outBoundEntryId 出库单编号
     * @return 出库单对象
     */
    @Override
    public WhOutbound getWhOutboundById(Integer outBoundEntryId) {
        return whOutboundMapper.selectById(outBoundEntryId);
    }

    /**
     * 添加出库单
     * @param whOutbound 出库单对象
     * @return 影响行数
     */
    @Override
    public int addWhOutbound(WhOutbound whOutbound) {
        return whOutboundMapper.insert(whOutbound);
    }

    /**
     * 删除出库单
     * @param outBoundEntryId 出库单编号
     * @return 影响行数
     */
    @Override
    public int deleteWhOutbound(Integer outBoundEntryId) {
        return whOutboundMapper.deleteById(outBoundEntryId);
    }

    /**
     * 修改出库单
     * @param whOutbound 出库单对象
     * @return 影响行数
     */
    @Override
    public int updateWhOutbound(WhOutbound whOutbound) {
        return whOutboundMapper.updateById(whOutbound);
    }


}
